package com.eva.framework.security;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.annotation.Resource;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Data
@Schema(description = "安全配置")
@Configuration
@ConfigurationProperties(prefix = "app.security", ignoreInvalidFields = true)
public class SecureProperties {

    @Resource
    @Schema(description = "数据安全密钥定义")
    private SecureData data;

    @Resource
    @Schema(description = "数据传输安全密钥定义")
    private SecureTransmission transmission;

    @Data
    @Configuration
    @Schema(description = "数据安全配置")
    public static class SecureData {

        @Schema(description = "密钥")
        private String key;

        @Schema(description = "密钥长度")
        private Integer keyLen;

        @Schema(description = "偏移量")
        private String iv;
    }

    @Data
    @Configuration
    @Schema(description = "接口数据传输安全配置")
    public static class SecureTransmission {

        @Schema(description = "密钥")
        private String key;

        @Schema(description = "密钥长度")
        private Integer keyLen;

        @Schema(description = "偏移量")
        private String iv;

        @Schema(description = "需要加密的接口路径")
        private String[] pathPatterns;

        @Schema(description = "不需要加密的接口路径")
        private String[] excludePathPatterns;
    }
}
